package com.zksite.nator.client;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Main {

	private static final Logger LOGGER = LoggerFactory.getLogger(Main.class);

	private static boolean running = true;

	public static void main(String[] args) {
		ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(
				"spring-context-base.xml");
		Runtime.getRuntime().addShutdownHook(new Thread() {
			public void run() {
				LOGGER.info("Shutting down nator server...");
				synchronized (Main.class) {
					running = false;
					Main.class.notify();
				}
			}
		});
		synchronized (Main.class) {
			while (running) {
				try {
					Main.class.wait();
				} catch (Throwable e) {
				}
			}
		}
		applicationContext.close();
	}

}
